version: "3.8"

services:
  mysql:
    image: mysql:5.7.37
    environment:
      - MYSQL_ROOT_PASSWORD=123456
    command: --default-authentication-plugin=mysql_native_password
    volumes:
      - /data/mysql:/var/lib/mysql
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "3306:3306"
    networks:
      - "default"
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints: [node.role == manager]
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 120s
networks:
  default:
    external:
      name: traefik_default